package interview9;

import org.junit.Test;

/**
 * @author Jack
 * @date 2019-11-05-11:05
 */
public class SolutionTest {

    @Test
    public void testNormalPushAndPop() throws Exception {
        Solution solution = new Solution();
        for (int i = 0; i < 10; i++) {
            solution.appendTail(i+1);
        }
        //弹出的元素为1
        Object head = solution.deleteHead();
        System.out.println("弹出的队头元素:"+head);
        solution.appendTail(11);
        //弹出的元素为2
        head = solution.deleteHead();
        System.out.println("弹出的队头元素:"+head);
    }

    @Test
    public void testNullPushThenPop() throws Exception {
        Solution solution = new Solution();
        //弹出的元素为1
        Object head = solution.deleteHead();
        System.out.println("弹出的队头元素:"+head);
    }

    @Test
    public void testPopAllElements() throws Exception {
        Solution solution = new Solution();
        for (int i = 0; i < 10; i++) {
            solution.appendTail(i+1);
        }
        while (true){
            //弹出的元素为1
            Object head = solution.deleteHead();
            System.out.println("弹出的队头元素:"+head);
        }
    }

}
